% ctex style settings
\ifthenelse{\equal{\Degree}{undergraduate}}
{
    \ctexset
    {
        part =
        {
            format=\centering\zihao{-0}\bfseries,
            nameformat=\centering\heiti\fontsize{48}{48}\bfseries,
        },
        chapter =
        {
            format=\centering\zihao{3}\bfseries,
            name={,、},
            aftername=,
            number=\chinese{chapter},
            beforeskip=12pt,
            afterskip=6pt
        },
        section =
        {
            format=\raggedright\zihao{3}\bfseries,
            name={},
            number=\arabic{section},
            beforeskip=13pt,
            afterskip=13pt
        },
        subsection =
        {
            format=\raggedright\zihao{-3}\bfseries,
            name={},
            number=\arabic{section}.\arabic{subsection},
            beforeskip=13pt,
            afterskip=13pt
        },
        subsubsection =
        {
            format=\raggedright\zihao{4}\bfseries,
            name={},
            aftername=~,
            numbering=true,
            number=\arabic{section}.\arabic{subsection}.\arabic{subsubsection},
            beforeskip=0pt,
            afterskip=0pt
        }
    }
}
{
    \ctexset
    {
        part =
        {
            format=\centering\zihao{-0}\bfseries,
            nameformat=\centering\heiti\fontsize{48}{48}\bfseries,
        },
        chapter =
        {
            format=\raggedright\zihao{-3}\bfseries,
            name={},
            number=\arabic{chapter},
            beforeskip=12pt,
            afterskip=6pt
        },
        section =
        {
            format=\raggedright\zihao{4}\bfseries,
            name={},
            number=\arabic{chapter}.\arabic{section},
            beforeskip=13pt,
            afterskip=13pt
        },
        subsection =
        {
            format=\raggedright\zihao{-4}\bfseries,
            name={},
            number=\arabic{chapter}.\arabic{section}.\arabic{subsection},
            beforeskip=13pt,
            afterskip=13pt
        },
        subsubsection =
        {
            format=\raggedright\zihao{-4},
            name={},
            aftername=~,
            numbering=true,
            number=\arabic{chapter}.\arabic{section}.\arabic{subsection}.\arabic{subsubsection},
            beforeskip=0pt,
            afterskip=0pt
        }
    }
}

% Reset chapter number each part
\makeatletter
\@addtoreset{chapter}{part}
\makeatother

\ifthenelse{\equal{\Degree}{undergraduate}}
{
    \renewcommand{\contentsname}{目录}
}
{
    \renewcommand{\contentsname}{目录}
    \newcommand{\markloc}{\addcontentsline{toc}{chapter}{目录}}
    \renewcommand{\listfigurename}{图目录}
    \newcommand{\marklof}{\addcontentsline{toc}{chapter}{图目录}}
    \renewcommand{\listtablename}{表目录}
    \newcommand{\marklot}{\addcontentsline{toc}{chapter}{表目录}}
}

% Change biblography title style for `biblatex`
\ifthenelse{\equal{\Degree}{undergraduate}}
{
    \defbibheading{bibliography}[\bibname]{
        \section{#1}
        \markboth{#1}{#1}
    }
}
{
    \defbibheading{bibliography}[\bibname]{
        \chapternonum{#1}
    }
}